package test;

import java.lang.reflect.Field;

/**
 * @Author: admin
 * @Description:
 * @Date: 2019/4/10 9:10
 */

public class Str {
    public static void main(String[] args) throws NoSuchFieldException, IllegalAccessException {
        String m="123";
        String n="123";
        String i=new String(m);
        String j=new String("123");

        System.out.println(m==n);
        System.out.println(m.equals(n));

        System.out.println(i==n);
        System.out.println(i.equals(n));

        System.out.println(i==j);
        System.out.println(i.equals(j));




        Field f = m.getClass().getDeclaredField("value");
        f.setAccessible(true);
        char[] cs = (char[]) f.get(m);
        cs[0] = 'H';

        System.out.println(m);
        System.out.println(n);
        System.out.println(i);
        System.out.println(j);

    }
}
